<!-- HTML header for doxygen 1.8.5-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.17"/>
<title>GenAVB/TSN: Timer</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<script src="http://www.freescale.com/files/abstract/misc/COLLATERALTEMPLATE_infocenter.js" type="text/javascript" xml:space="preserve"><!-- --></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
  $(document).ready(function() { init_search(); });
/* @license-end */
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="html_custom.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="nxp_logo.png"/></td>
  <td style="padding-left: 0.5em;">
   <div id="projectname">GenAVB/TSN
   </div>
  </td>
   <td>        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
</td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.17 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('group__timer.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#enum-members">Enumerations</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">Timer<div class="ingroups"><a class="el" href="group__library.html">Library API</a></div></div>  </div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">Overview</h2>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="enum-members"></a>
Enumerations</h2></td></tr>
<tr class="memitem:ga6d99f610a7aec7ff92b2cfb4cabe56ce"><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__timer.html#ga6d99f610a7aec7ff92b2cfb4cabe56ce">genavb_timer_f_t</a> { <br />
&#160;&#160;<a class="el" href="group__timer.html#gga6d99f610a7aec7ff92b2cfb4cabe56cea6f35d958e3349e51211dd3d2cf67157f">GENAVB_TIMERF_ABS</a> = 0x01, 
<br />
&#160;&#160;<a class="el" href="group__timer.html#gga6d99f610a7aec7ff92b2cfb4cabe56ceaafd5ec75682eb8eeb0c61fd376352f26">GENAVB_TIMERF_PPS</a> = 0x02
<br />
 }</td></tr>
<tr class="separator:ga6d99f610a7aec7ff92b2cfb4cabe56ce"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga065ba556ab3af78941391f4a1ce7758a"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__timer.html#ga065ba556ab3af78941391f4a1ce7758a">genavb_timer_create</a> (struct genavb_timer **t, <a class="el" href="group__clock.html#ga5ef1c8a12d6be59e079dc5664e2bcd86">genavb_clock_id_t</a> id, <a class="el" href="group__timer.html#ga6d99f610a7aec7ff92b2cfb4cabe56ce">genavb_timer_f_t</a> flags)</td></tr>
<tr class="separator:ga065ba556ab3af78941391f4a1ce7758a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga582d77a584160b1d7761fb6f5b994047"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__timer.html#ga582d77a584160b1d7761fb6f5b994047">genavb_timer_set_callback</a> (struct genavb_timer *t, void(*callback)(void *data, int count), void *data)</td></tr>
<tr class="separator:ga582d77a584160b1d7761fb6f5b994047"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga1ea650d3b4107e03397dbb66022e5d22"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__timer.html#ga1ea650d3b4107e03397dbb66022e5d22">genavb_timer_start</a> (struct genavb_timer *t, uint64_t value, uint64_t interval, <a class="el" href="group__timer.html#ga6d99f610a7aec7ff92b2cfb4cabe56ce">genavb_timer_f_t</a> flags)</td></tr>
<tr class="separator:ga1ea650d3b4107e03397dbb66022e5d22"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga72b8afcf4a94e46387f7ccafb8e33339"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__timer.html#ga72b8afcf4a94e46387f7ccafb8e33339">genavb_timer_stop</a> (struct genavb_timer *t)</td></tr>
<tr class="separator:ga72b8afcf4a94e46387f7ccafb8e33339"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga598543f709318ea7453741c393fce297"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__timer.html#ga598543f709318ea7453741c393fce297">genavb_timer_destroy</a> (struct genavb_timer *t)</td></tr>
<tr class="separator:ga598543f709318ea7453741c393fce297"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Enumeration Type Documentation</h2>
<a id="ga6d99f610a7aec7ff92b2cfb4cabe56ce"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga6d99f610a7aec7ff92b2cfb4cabe56ce">&#9670;&nbsp;</a></span>genavb_timer_f_t</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">enum <a class="el" href="group__timer.html#ga6d99f610a7aec7ff92b2cfb4cabe56ce">genavb_timer_f_t</a></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Useful flags: </p>
<table class="fieldtable">
<tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><a id="gga6d99f610a7aec7ff92b2cfb4cabe56cea6f35d958e3349e51211dd3d2cf67157f"></a>GENAVB_TIMERF_ABS&#160;</td><td class="fielddoc"><p>Interpret provided time value as absolute. </p>
</td></tr>
<tr><td class="fieldname"><a id="gga6d99f610a7aec7ff92b2cfb4cabe56ceaafd5ec75682eb8eeb0c61fd376352f26"></a>GENAVB_TIMERF_PPS&#160;</td><td class="fielddoc"><p>Request or enable PPS signal output. </p>
</td></tr>
</table>

</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a id="ga065ba556ab3af78941391f4a1ce7758a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga065ba556ab3af78941391f4a1ce7758a">&#9670;&nbsp;</a></span>genavb_timer_create()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int genavb_timer_create </td>
          <td>(</td>
          <td class="paramtype">struct genavb_timer **&#160;</td>
          <td class="paramname"><em>t</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__clock.html#ga5ef1c8a12d6be59e079dc5664e2bcd86">genavb_clock_id_t</a>&#160;</td>
          <td class="paramname"><em>id</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__timer.html#ga6d99f610a7aec7ff92b2cfb4cabe56ce">genavb_timer_f_t</a>&#160;</td>
          <td class="paramname"><em>flags</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Allocate/create a new timer. </p>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group__generic.html#gga031a0b2111b623fef60d707141a995d5a652003ceb0485f27d4a45e7c29dffe7f" title="Success.">GENAVB_SUCCESS</a> or negative error code. </dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">t</td><td>pointer to the struct genavb_timer context </td></tr>
    <tr><td class="paramname">id</td><td>clock id </td></tr>
    <tr><td class="paramname">flags</td><td>the following flags may be bitwise ORed:<br  />
 <a class="el" href="group__timer.html#gga6d99f610a7aec7ff92b2cfb4cabe56ceaafd5ec75682eb8eeb0c61fd376352f26" title="Request or enable PPS signal output.">GENAVB_TIMERF_PPS</a> request a timer with PPS signal output support. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ga582d77a584160b1d7761fb6f5b994047"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga582d77a584160b1d7761fb6f5b994047">&#9670;&nbsp;</a></span>genavb_timer_set_callback()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int genavb_timer_set_callback </td>
          <td>(</td>
          <td class="paramtype">struct genavb_timer *&#160;</td>
          <td class="paramname"><em>t</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void(*)(void *data, int count)&#160;</td>
          <td class="paramname"><em>callback</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>data</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Set the timer callback. </p>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group__generic.html#gga031a0b2111b623fef60d707141a995d5a652003ceb0485f27d4a45e7c29dffe7f" title="Success.">GENAVB_SUCCESS</a> or negative error code. </dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">t</td><td>pointer to the struct genavb_timer context </td></tr>
    <tr><td class="paramname">callback</td><td>callback function pointer. Its arguments are the callback data as provided in this API and count which is the number of times the timer expired and if negative indicates a clock discontinuity. In this case, the timer has been stopped and needs to be re-started. </td></tr>
    <tr><td class="paramname">data</td><td>callback data </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ga1ea650d3b4107e03397dbb66022e5d22"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga1ea650d3b4107e03397dbb66022e5d22">&#9670;&nbsp;</a></span>genavb_timer_start()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int genavb_timer_start </td>
          <td>(</td>
          <td class="paramtype">struct genavb_timer *&#160;</td>
          <td class="paramname"><em>t</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint64_t&#160;</td>
          <td class="paramname"><em>value</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint64_t&#160;</td>
          <td class="paramname"><em>interval</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__timer.html#ga6d99f610a7aec7ff92b2cfb4cabe56ce">genavb_timer_f_t</a>&#160;</td>
          <td class="paramname"><em>flags</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Setup and start a timer created by <a class="el" href="group__timer.html#ga065ba556ab3af78941391f4a1ce7758a" title="Allocate/create a new timer.">genavb_timer_create()</a> If the timer is already running it is re-started with new period. </p>
<p>For periodic timers, the first expiration happens at the end of the first period (value + interval).</p>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group__generic.html#gga031a0b2111b623fef60d707141a995d5a652003ceb0485f27d4a45e7c29dffe7f" title="Success.">GENAVB_SUCCESS</a> or negative error code. </dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">t</td><td>pointer to the OS-dependent struct os_timer to start </td></tr>
    <tr><td class="paramname">value</td><td>expiration time in nanoseconds (for a one shot timer). Start of the first period (for a periodic timer), usually 0. </td></tr>
    <tr><td class="paramname">interval</td><td>periodic timer value in nanoseconds . If zero, the timer is one shot. </td></tr>
    <tr><td class="paramname">flags</td><td>the following flags may be bitwise ORed:<br  />
 <a class="el" href="group__timer.html#gga6d99f610a7aec7ff92b2cfb4cabe56ceaafd5ec75682eb8eeb0c61fd376352f26" title="Request or enable PPS signal output.">GENAVB_TIMERF_PPS</a> enable the PPS signal output. The timer needs to have been successfully created with the same flag.<br  />
 <a class="el" href="group__timer.html#gga6d99f610a7aec7ff92b2cfb4cabe56cea6f35d958e3349e51211dd3d2cf67157f" title="Interpret provided time value as absolute.">GENAVB_TIMERF_ABS</a> the "value" argument is provided in absolute time. If not set the time is relative. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ga72b8afcf4a94e46387f7ccafb8e33339"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga72b8afcf4a94e46387f7ccafb8e33339">&#9670;&nbsp;</a></span>genavb_timer_stop()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void genavb_timer_stop </td>
          <td>(</td>
          <td class="paramtype">struct genavb_timer *&#160;</td>
          <td class="paramname"><em>t</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Stop a running timer The function can be safely called if the timer is already stopped. </p>
<dl class="section return"><dt>Returns</dt><dd>none </dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">t</td><td>pointer to the genavb_timer to stop </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ga598543f709318ea7453741c393fce297"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga598543f709318ea7453741c393fce297">&#9670;&nbsp;</a></span>genavb_timer_destroy()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void genavb_timer_destroy </td>
          <td>(</td>
          <td class="paramtype">struct genavb_timer *&#160;</td>
          <td class="paramname"><em>t</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Destroy/free a timer If the timer is still running it will be stopped first. </p>
<dl class="section return"><dt>Returns</dt><dd>none </dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">t</td><td>pointer to the genavb_timer to destroy </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- HTML footer for doxygen 1.8.5-->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul class="foot">
    <li class="footer"> &copy; 2017-2020 NXP
    </li>
  </ul>
</div>
</body>
</html>
